<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Merge / MergeLuma / MergeChroma Avisynth Filter</title>
<link rel="stylesheet" type="text/css" href="../../avisynth.css">
</head>
<body>
<h2>
<a name="Merge"></a>Merge / MergeChroma / MergeLuma 
</h2>

<p><code>Merge </code>(<var>clip1, clip2, float weight=0.5</var>)&nbsp;<code><br>
MergeChroma </code>(<var>clip1, clip2, float weight=1.0</var>)<br>
  <code>MergeLuma </code>(<var>clip1, clip2, float weight=1.0</var>)

<p>  These filters make it possible to merge pixels
  (or, for YUV clips only, just the luma or chroma) from one videoclip
  into another. There is an optional weighting, so a percentage between the two clips
  can be specified. <code>Merge</code> is present in <em>v2.56</em>.

<p><var>clip1</var> is the clip that has the appropriate data merged INTO (based on
which filter you use). In the case of
  <code>MergeLuma </code> or <code>
MergeChroma</code>, that means that the OTHER channel
(chroma or luma respectively) is completely untouched.

<p><var>clip2</var> is the one from which the pixel data must be taken. In
  <code>MergeChroma</code>, this is where the Chroma will be taken from, and
  vice-versa for <code>MergeLuma</code>. It must be the same colorspace as clip1; i.e. you cannot merge from a YV12 clip into a YUY2 clip.

<p>The <var>weight</var> defines how much influence the new clip should have. Range
  is 0.0 to 1.0, where 0.0 is no influence and 1.0 will completely overwrite the
  specified channel. The default is 0.5 for <code>Merge</code> and 1.0 for <code>
  MergeChroma</code> and <code>MergeLuma</code>. The filter will be slightly
slower when a weight other than 0.0, 0.5 or 1.0 is specified.

<p>Also see <a href="../syntax.htm#multiclip" target="_self">here</a> for the 
  resulting clip properties.

<pre># Will only blur the Luma channel.
mpeg2source(&quot;c:\apps\avisynth\main.d2v&quot;)
lumvid = Blur(1.0)
MergeLuma(lumvid)

# This will do a Spatial Smooth on the Chroma channel
# that will be mixed 50/50 with the original image.
mpeg2source(&quot;c:\apps\avisynth\main.d2v&quot;)
chromavid = SpatialSmoother(2,3) 
MergeChroma(chromavid,0.5)

# This will run a temporalsmoother and a soft spatial
# smoother on the Luma channel, and a more agressive
# spatial smoother on the Chroma channel.
# The original luma channel is then added with the
# smoothed version at 75%. The chroma channel is
# fully replaced with the blurred version.
mpeg2source(&quot;c:\apps\avisynth\main.d2v&quot;)
luma = TemporalSmoother(2,3)
luma = luma.Spatialsmoother(3,10,10)
chroma = Spatialsmoother(3,40,40)
MergeLuma(luma,0.75)
MergeChroma(chroma)

# This will average two video sources.
avisource(&quot;c:\apps\avisynth\main.avi&quot;)
vid2 = avisource(&quot;c:\apps\avisynth\main2.avi&quot;)
Merge(vid2)</pre>
      
<p><b>Changelog:</b></p>
      
<table border="1" width="12%">
  <tr>
    <td width="5%">v2.56</td>
    <td width="95%">added Merge</td>
  </tr>
</table>
      
<p><kbd>$Date: 2010/04/04 16:46:19 $</kbd></p>
<form>
<input type="Button" value="Back"
onClick="history.go(-1)">
</form>
</body>
</html>
